﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using ERCS.Model;


namespace ERCS.ViewModel.Patients.PatientVMs
{
    public partial class PatientBatchVM : BaseBatchVM<Patient, Patient_BatchEdit>
    {
        public PatientBatchVM()
        {
            ListVM = new PatientListVM();
            LinkedVM = new Patient_BatchEdit();
        }

        public override void Validate()
        {
            if (LinkedVM.Status != PatientStatusEnum.ZhiYu)
            {
                MSD.AddModelError("LinkedVM.Status", "必须选治愈！");
            }
        }


        public override bool DoBatchEdit()
        {
            return base.DoBatchEdit();
        }
    }

	/// <summary>
    /// 批量编辑字段类
    /// </summary>
    public class Patient_BatchEdit : BaseVM
    {
        [Display(Name = "状态")]
        [Required(ErrorMessage = "状态必填")]
        public PatientStatusEnum? Status { get; set; }
        public List<ComboSelectListItem> AllVirusess { get; set; }
        [Display(Name = "病毒")]
        public List<Guid> SelectedVirusesIDs { get; set; }

        protected override void InitVM()
        {
            AllVirusess = DC.Set<Virus>().GetSelectListItems(LoginUserInfo?.DataPrivileges, null, y => y.VirusName);
        }


    }

}
